package com.hzhq.contract.bean.entity;

import com.fasterxml.jackson.annotation.JsonFormat;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.AllArgsConstructor;
import lombok.Builder;
import lombok.Data;
import lombok.NoArgsConstructor;
import org.bson.types.ObjectId;
import org.springframework.data.annotation.Id;
import org.springframework.data.mongodb.core.index.Indexed;
import org.springframework.data.mongodb.core.mapping.DBRef;
import org.springframework.data.mongodb.core.mapping.Document;
import org.springframework.data.mongodb.core.mapping.Field;

import java.math.BigDecimal;
import java.util.Date;
import java.util.List;
import java.util.Map;

/**
 * @author hzhq
 * @create 2021/3/24 11:07 下午
 * @email hzhq1255@163.com
 */
@Data
@Builder
@AllArgsConstructor
@NoArgsConstructor
@Document("contract_template")
@ApiModel(value = "模板信息",description = "模板信息")
public class ContractTemplate {

    public static final String TEMPLATE_ID_FIELD = "_id";
    public static final String TEMPLATE_NAME_FIELD = "template_name";
    public static final String CONTRACT_TYPE_FIELD = "contract_type";
    public static final String COMPANIES_A_FIELD = "companiesA";
    public static final String COMPANIES_B_FIELD = "companiesB";
    public static final String CONTACT_PERSON_FIELD = "contact_person";
    public static final String CONTACT_PHONE_FIELD = "contact_phone";
    public static final String DEPART_FIELD = "depart";
    public static final String CONTRACT_AMOUNT_FIELD = "contract_amount";
    public static final String EXTERN_LIST_FIELD = "extern_list";
    public static final String CREATE_TIME_FIELD = "create_time";
    public static final String CREATE_USER_FIELD = "create_user";

    @Id
    @ApiModelProperty(value = "id")
    private ObjectId templateId;
    @ApiModelProperty(value = "模板名称")
    @Field("template_name")
    private String templateName;
    @ApiModelProperty(value = "合同种类")
    @DBRef
    @Field("contract_type")
    private ContractType contractType;
    @ApiModelProperty(value = "甲方公司")
    @DBRef
    @Field("companiesA")
    private List<Company> companiesA;
    @ApiModelProperty(value = "乙方公司")
    @DBRef
    @Field("companiesB")
    private List<Company> companiesB;
    @ApiModelProperty(value = "负责人")
    @Field("contact_person")
    private String contactPerson;
    @ApiModelProperty(value = "负责人联系方式")
    @Field("contact_phone")
    private String contactPhone;
    @ApiModelProperty(value = "所属部门")
    @DBRef
    @Field("depart")
    private Depart depart;
    @ApiModelProperty(value = "合同金额")
    @Field("contract_amount")
    private BigDecimal contractAmount;
    @ApiModelProperty(value = "自定义扩展字段")
    @Field("extern_list")
    private List<Extern> externList;
    @ApiModelProperty(value = "创建时间")
    @JsonFormat(locale="zh", timezone="GMT+8", pattern="yyyy-MM-dd")
    @Field("create_time")
    private Date createTime;
    @ApiModelProperty(value = "是否删除")
    @Field("deleted")
    private Integer deleted;
    @ApiModelProperty(value = "是否通过")
    @Field("passed")
    private Integer passed;
    @ApiModelProperty(value = "创建人")
    @DBRef
    @Field("create_user")
    private User createUser;



}
